<%-- 
    Document   : listarReservas
    Created on : 29-dic-2011, 2:54:34
    Author     : Administrador
--%>
<%@taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <div id="bodydiv">
            <span style="color: #0395CC; margin-top: 20px; font-size: 20pt; font-family: Arial;"><b>Lista de reservas</b></span>
            <hr />
            <br />
            <c:if test="${not empty sessionScope.reservas}">
                <table border="0">
                    <tr>
                        <td style="width: 120px; background:#a52a2a; color: #FFFFFF; border: 1px solid #444444; text-align: center;"><b>Fecha</b></td>
                        <td style="width: 240px; background:#a52a2a; color: #FFFFFF; border: 1px solid #444444; text-align: center;"><b>Pelicula</b></td>
                        <td style="width: 120px; background:#a52a2a; color: #FFFFFF; border: 1px solid #444444; text-align: center;"><b>Funcion</b></td>
                        <td style="width: 120px; background:#a52a2a; color: #FFFFFF; border: 1px solid #444444; text-align: center;"><b>Cine</b></td>
                        <td style="width: 100px; background:#a52a2a; color: #FFFFFF; border: 1px solid #444444; text-align: center;"><b>Salas</b></td>
                        <td style="width: 120px; background:#a52a2a; color: #FFFFFF; border: 1px solid #444444; text-align: center;"><b>Total</b></td>
                        <td style="width: 100px; background:#a52a2a; color: #FFFFFF; border: 1px solid #444444; text-align: center;"><b>Entradas</b></td>
                    </tr>
                    <c:forEach var="reserva" items="${sessionScope.reservas}">
                        <tr>

                            <td><fmt:formatDate value="${reserva.fecha}" dateStyle="medium"></fmt:formatDate>  </td>
                            <td>${reserva.pelicula.nombre}</td>
                            <td><fmt:formatDate value="${reserva.funcion.fecha}"  dateStyle="medium" pattern="dd/MM/yyyy HH:mm"></fmt:formatDate>  </td>
                            <td>${reserva.funcion.cine.nombre}</td>
                            <td>${reserva.funcion.sala.numero}</td>
                            <td>${reserva.costoTotal}</td>
                            <td>
                                <c:forEach var="tipo" items="${reserva.tiposEntradas}">
                                    ${tipo.tipoEntrada} ${tipo.precio} ${tipo.cantidad}</br>
                                </c:forEach>
                            </td>
                        </tr>
                    </c:forEach>
                </table>
            </c:if>
            <td></td>
            <td></td>
            <td>&nbsp
                <c:if test="${not empty requestScope.error}">
                    <font color="red">${requestScope.error}</font>
                    <c:remove scope="request" var="error" /> 
                </c:if>
            </td>
        </div>
        <jsp:include page="index.jsp" />
        <script type="text/javascript">
            $(document).ready(function(){
                
                //Verifico si se pidiron los datos de las salas para un cine y lo muestro
                if($("#verificador").val() == 1){
                    $("#salas").dialog({
                        title: 'Salas'}
                );
                }
            });
        </script>
    </body>
</html>
